﻿package mortal.game.scene3D.fight
{
    import Framework.MQ.*;
    import Message.BroadCast.*;
    import Message.DB.Tables.*;
    import Message.Game.*;
    import Message.Public.*;
    import __AS3__.vec.*;
    import baseEngine.modifiers.*;
    import baseEngine.system.*;
    import com.gengine.core.*;
    import com.gengine.debug.*;
    import com.gengine.global.*;
    import com.gengine.utils.*;
    import com.gengine.utils.pools.*;
    import com.greensock.*;
    import com.greensock.easing.*;
    import com.mui.controls.*;
    import flash.geom.*;
    import flash.text.*;
    import flash.utils.*;
    import frEngine.event.*;
    import mortal.common.global.*;
    import mortal.common.sound.*;
    import mortal.component.gconst.*;
    import mortal.game.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.ai.ais.*;
    import mortal.game.scene3D.events.*;
    import mortal.game.scene3D.layer3D.*;
    import mortal.game.scene3D.layer3D.utils.*;
    import mortal.game.scene3D.map3D.AstarAnyDirection.*;
    import mortal.game.scene3D.map3D.util.*;
    import mortal.game.scene3D.model.data.*;
    import mortal.game.scene3D.model.player.*;
    import mortal.game.scene3D.player.entity.*;
    import mortal.game.scene3D.player.info.*;
    import mortal.game.scene3D.util.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.skill.*;
    import mortal.game.view.skillProgress.*;
    import mortal.game.view.systemSetting.*;
    import mortal.game.view.wizard.data.*;
    import mortal.game.view.wizard.panel.*;
    import mortal.mvc.core.*;

    public class FightEffectUtil extends Object
    {
        private var _isStart:Boolean = false;
        private var _dcFight:Dictionary;
        private var _gThis:FightEffectUtil;
        private var _textFiled:GTextFiled;
        private var vcBeginFight:Vector.<SBeginFight>;
        private var comboDic:Dictionary;
        public static var attackMeMonster:MonsterPlayer;
        public static var attackMeCheck:int = -1;
        public static var attackMeMonsterList:Vector.<SEntityId> = new Vector.<SEntityId>;
        public static var attackMeUserList:Vector.<SEntityId> = new Vector.<SEntityId>;
        public static var attackMePetList:Vector.<SEntityId> = new Vector.<SEntityId>;
        private static var dicMonsterTimer:Dictionary = new Dictionary(true);
        private static var dicUserTimer:Dictionary = new Dictionary(true);
        private static var dicPetTimer:Dictionary = new Dictionary(true);
        private static var skillTransferId:int = -1;
        private static var skillTransferIsChange:Boolean = false;
        private static var skillTransferPoint:Point = new Point();

        public function FightEffectUtil()
        {
            this._dcFight = new Dictionary();
            this.vcBeginFight = new Vector.<SBeginFight>;
            this.comboDic = new Dictionary();
            this._gThis = this;
            this._textFiled = UIFactory.textField("", 0, 0, -1, -1, null, GlobalStyle.textFormatItemWhite.setSize(16));
            this._textFiled.autoSize = TextFieldAutoSize.LEFT;
            return;
        }// end function

        private function onPlayerFireHandler(event:ParamsEvent) : void
        {
            var _loc_3:SBeginFight = null;
            var _loc_2:* = event.params[0] as SpritePlayer;
            if (this.vcBeginFight.length > 0)
            {
                _loc_3 = this.vcBeginFight.shift();
                this.beginFight(_loc_3);
            }
            else
            {
                FrEventDispatcher.instance.proxyRemoveEventListener(_loc_2, PlayerEvent.PLAYER_FIRE, this.onPlayerFireHandler);
            }
            return;
        }// end function

        protected function getEntity(param1:SEntityId, param2:IMessageEx = null) : IEntity
        {
            return ThingUtil.entityUtil.getEntity(param1);
        }// end function

        protected function getEntityInfo(param1:SEntityId, param2:IMessageEx = null) : EntityInfo
        {
            return Cache.instance.entity.getEntityInfoById(param1);
        }// end function

        protected function getSkillLayer() : SLayer3D
        {
            return Game.scene.playerLayer;
        }// end function

        public function beginFight(param1:SBeginFight, param2:Boolean = false) : void
        {
            var i:int;
            var toPlayer:SpritePlayer;
            var fromPlayer:SpritePlayer;
            var skill:TSkill;
            var targetPoint:Point;
            var targetJumpPoint:Point;
            var targetRushForwardPoint:Point;
            var beatMovePoint:Point;
            var attUpdate:SAttributeUpdate;
            var fromEntityInfo:EntityInfo;
            var fightEffect:FightEffectBase;
            var masterInfo:EntityInfo;
            var wizardData:WizardData;
            var wizardModel:String;
            var buff:TBuff;
            var sbeginFight:* = param1;
            var isComboImm:* = param2;
            if (sbeginFight == null)
            {
                return;
            }
            var isEnemy:Boolean;
            var toEntitys:* = sbeginFight.toEntitys;
            var toPlayers:* = new Vector.<SpritePlayer>;
            fromPlayer = this.getEntity(sbeginFight.fromEntity, sbeginFight.msgEx) as SpritePlayer;
            var skillID:int;
            var isRelationToRole:Boolean;
            var _loc_4:int = 0;
            var _loc_5:* = sbeginFight.propertyUpdates;
            while (_loc_5 in _loc_4)
            {
                
                attUpdate = _loc_5[_loc_4];
                switch(attUpdate.attribute.value())
                {
                    case EEntityAttribute._EAttributeAttackSkill:
                    {
                        skillID = attUpdate.value;
                        break;
                    }
                    case EEntityAttribute._EAttributePointX:
                    {
                        if (!targetPoint)
                        {
                            targetPoint = new Point();
                        }
                        targetPoint.x = attUpdate.value;
                        break;
                    }
                    case EEntityAttribute._EAttributePointY:
                    {
                        if (!targetPoint)
                        {
                            targetPoint = new Point();
                        }
                        targetPoint.y = attUpdate.value;
                        break;
                    }
                    case EEntityAttribute._EAttributeJumpCutPointX:
                    {
                        if (!targetJumpPoint)
                        {
                            targetJumpPoint = new Point();
                        }
                        targetJumpPoint.x = attUpdate.value;
                        break;
                    }
                    case EEntityAttribute._EAttributeJumpCutPointY:
                    {
                        if (!targetJumpPoint)
                        {
                            targetJumpPoint = new Point();
                        }
                        targetJumpPoint.y = attUpdate.value;
                        break;
                    }
                    case EEntityAttribute._EAttributeRushForwardPointX:
                    {
                        if (!targetRushForwardPoint)
                        {
                            targetRushForwardPoint = new Point();
                        }
                        targetRushForwardPoint.x = attUpdate.value;
                        break;
                    }
                    case EEntityAttribute._EAttributeRushForwardPointY:
                    {
                        if (!targetRushForwardPoint)
                        {
                            targetRushForwardPoint = new Point();
                        }
                        targetRushForwardPoint.y = attUpdate.value;
                        break;
                    }
                    case EEntityAttribute._EAttributeBeatMoveFromPointX:
                    {
                        if (!beatMovePoint)
                        {
                            beatMovePoint = new Point();
                        }
                        beatMovePoint.x = attUpdate.value;
                        break;
                    }
                    case EEntityAttribute._EAttributeBeatMoveFromPointY:
                    {
                        if (!beatMovePoint)
                        {
                            beatMovePoint = new Point();
                        }
                        beatMovePoint.y = attUpdate.value;
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
            }
            fromEntityInfo = Cache.instance.entity.getEntityInfoById(sbeginFight.fromEntity);
            if (fromEntityInfo)
            {
                isRelationToRole = isRelationToRole || EntityRelationUtil.isOwnerSelf(fromEntityInfo.entityInfo);
            }
            if (isEnemy)
            {
                i;
                while (i < toEntitys.length)
                {
                    
                    if (EntityUtil.equal(toEntitys[i] as SEntityId, Cache.instance.role.entityInfo.entityId))
                    {
                        if (fromEntityInfo)
                        {
                            fromEntityInfo.updateIsAttackRole(true);
                            masterInfo = EntityRelationUtil.getSummonMasterEntityInfo(fromEntityInfo.entityInfo);
                            if (masterInfo)
                            {
                                masterInfo.updateIsAttackRole(true);
                            }
                            break;
                        }
                    }
                    i = (i + 1);
                }
            }
            skill = SkillConfig.instance.getInfoById(skillID);
            if (!skill)
            {
                Log.debug("找不到技能！", skillID);
                return;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.ReleaseSkill, skillID));
            if (skill.triggerType == ESkillTriggType._ESkillTriggXp && fromPlayer && fromPlayer is RolePlayer)
            {
                if (Cache.instance.role.entityInfo.level >= GameConst.XPSkillEffectLevel)
                {
                    wizardData = WizardUtil.getWizardDataBySkillId(skill.skillId);
                    if (wizardData)
                    {
                        wizardModel = wizardData.tSprite.modelId;
                        WizardScreenPlayer.instance.play(wizardModel);
                    }
                }
            }
            if (fromPlayer is RolePlayer)
            {
                if (FightEffectComboUtil.instance.addComboFight(sbeginFight, skill, isComboImm))
                {
                    return;
                }
            }
            i;
            while (i < toEntitys.length)
            {
                
                if (EntityUtil.equal(toEntitys[i] as SEntityId, Cache.instance.role.entityInfo.entityId))
                {
                    if (fromPlayer is MonsterPlayer)
                    {
                        if (ThingUtil.entityUtil.isAttackAble(fromPlayer, false))
                        {
                            attackMeMonster = fromPlayer as MonsterPlayer;
                            if (attackMeCheck >= 0)
                            {
                                clearTimeout(attackMeCheck);
                            }
                            attackMeCheck = setTimeout(clearAttackMeMonster, 3000);
                            addToAttackList(fromPlayer.entityInfo.entityInfo.entityId, (fromPlayer as MonsterPlayer).tboss.attackSpeed + 1000);
                        }
                    }
                    if (fromPlayer is UserPlayer)
                    {
                        if (ThingUtil.entityUtil.isAttackAble(fromPlayer, false))
                        {
                            addToAttackList(fromPlayer.entityInfo.entityInfo.entityId, 3000);
                        }
                    }
                    break;
                }
                i = (i + 1);
            }
            i;
            while (i < toEntitys.length)
            {
                
                toPlayer = this.getEntity(toEntitys[i], sbeginFight.msgEx) as SpritePlayer;
                if (toPlayer)
                {
                    toPlayers.push(toPlayer);
                    isRelationToRole = isRelationToRole || EntityRelationUtil.isOwnerSelf(toPlayer.entityInfo.entityInfo);
                }
                i = (i + 1);
            }
            if (fromPlayer && (fromPlayer is RolePlayer || GameMapUtil.curMapState.isPetBreakMap && fromPlayer is PetPlayer))
            {
                if (!(skill.leadCount == 0 && skill.useTime > 0))
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.ScenePlaySkill, skillID));
                }
                else if (fromPlayer is RolePlayer)
                {
                    AutoFightAI.isLeading = true;
                }
            }
            var isCanselSelectTarget:Boolean;
            if (skill.type == ESkillType._ESkillTypeAddBuff)
            {
                buff = BuffConfig.instance.getInfoById(skill.additionBuff);
                if (buff && buff.type == EBuffType._EBuffTypeDisappear)
                {
                    isCanselSelectTarget;
                }
            }
            if (skill.type == ESkillType._ESkillTypeCopyBody)
            {
                isCanselSelectTarget;
            }
            if (isCanselSelectTarget && ThingUtil.selectEntity == fromPlayer)
            {
                ThingUtil.selectEntity = null;
            }
            var skillModel:* = SkillModelConfig.instance.getInfoById(skill.skillModel);
            if (fromPlayer is RolePlayer)
            {
                if (skill.spasticityTime > 0)
                {
                    RolePlayer.instance.spasticityBeginFight(skill.spasticityTime);
                }
                if (skillModel && !Global.isMinimize)
                {
                    RoleResourceUtil.addRoleSkill(skillModel.chainEffect, skillModel.daoguangModel, skillModel.hitModel, skillModel.selfModel, skillModel.targetModel, skillModel.trackModel);
                    if (skillModel.sound)
                    {
                        SoundManager.instance.soundPlayByName(skillModel.sound);
                    }
                }
                if ((skill.useTime > 0 || skill.leadTime > 0) && skill.type != ESkillType._ESKillTypeTornado)
                {
                    SkillProgressView.instance.start(skill);
                }
            }
            if (fromPlayer && (fromPlayer is MonsterPlayer && EntityRelationUtil.isOwnerSelf(fromPlayer.entityInfo.entityInfo) || EntityRelationUtil.isSelfPetByEntityId(fromPlayer.entityInfo.entityInfo.entityId)))
            {
                if (skill.skillId != 70000000 && skill.name != "宠物普通攻击" && skill.name)
                {
                    this._textFiled.text = skill.name;
                    fromPlayer.addSkillName(this._textFiled);
                }
            }
            if (!SkillUtil.isBrillyGouriSkill(skill.skillId) && (skill.useTime > 0 || skill.leadTime > 0))
            {
                fightEffect = ObjectPool.getObject(FightEffectLead);
                if (fromPlayer)
                {
                    fromPlayer.isInLeading = true;
                }
            }
            else
            {
                FightData.addBeginFight(sbeginFight.attackId);
                fightEffect = ObjectPool.getObject(FightEffectNormal);
            }
            fightEffect.setAttackId(sbeginFight.attackId);
            fightEffect.setFromPlayer(fromPlayer);
            fightEffect.setSkill(skill);
            fightEffect.isNotAutoShield = isRelationToRole || EntityRelationUtil.isMonsterPlayer(fromPlayer) && !EntityRelationUtil.isSummonMasterPlayer(fromPlayer);
            if (targetJumpPoint)
            {
                fightEffect.setTargetPoint(targetJumpPoint);
            }
            else if (targetRushForwardPoint)
            {
                fightEffect.setTargetPoint(targetRushForwardPoint);
            }
            else if (targetPoint)
            {
                fightEffect.setTargetPoint(targetPoint);
            }
            if (toPlayers.length)
            {
                fightEffect.setTargetPlayer(toPlayers[0]);
            }
            fightEffect.setHitPlayers(toPlayers);
            if (SkillUtil.isBrillyGouriSkill(skill.skillId) || skill.useTime <= 0 && skill.leadTime <= 0)
            {
                fightEffect.setCallBack(this.doFightBeginAttackId);
            }
            fightEffect.runStart();
            if (fromPlayer)
            {
                if (targetJumpPoint)
                {
                    JumpUtil.jumpCut(fromPlayer as MovePlayer, targetJumpPoint.x, targetJumpPoint.y, 0.7, 1, null);
                }
                else if (targetRushForwardPoint)
                {
                    JumpUtil.jumpCut(fromPlayer as MovePlayer, targetRushForwardPoint.x, targetRushForwardPoint.y, 0.2, 0.2, null);
                }
                if (beatMovePoint)
                {
                    if (fromPlayer is RolePlayer)
                    {
                        Global3D.stageFrame = 60;
                    }
                    fromPlayer.setRealPoint(beatMovePoint.x, beatMovePoint.y);
                    fromPlayer.tweenLite = TweenMax.to(fromPlayer, 0.2, {x2d:beatMovePoint.x, y2d:beatMovePoint.y, frameInterval:1, ease:Linear.easeIn, onUpdate:function () : void
            {
                if (fromPlayer is RolePlayer)
                {
                    (fromPlayer as RolePlayer).setCurrentPointImpl();
                    ThingUtil.isMoveChange = true;
                }
                else
                {
                    ThingUtil.isEntitySort = true;
                }
                return;
            }// end function
            , onComplete:function () : void
            {
                (fromPlayer as MovePlayer).updateCurrentAlpha();
                fromPlayer.removeTweenLite();
                return;
            }// end function
            });
                }
            }
            return;
        }// end function

        public function skillCast(param1:SSkillCast) : void
        {
            var _loc_7:SpritePlayer = null;
            var _loc_9:FightEffectBase = null;
            var _loc_10:Point = null;
            var _loc_2:* = SkillConfig.instance.getInfoById(param1.skillId);
            var _loc_3:* = ThingUtil.entityUtil.getEntity(param1.entityId) as SpritePlayer;
            var _loc_4:Boolean = false;
            if (!_loc_3)
            {
                return;
            }
            _loc_4 = _loc_4 || EntityRelationUtil.isOwnerSelf(_loc_3.entityInfo.entityInfo);
            var _loc_5:* = SkillModelConfig.instance.getInfoById(_loc_2.skillModel);
            if (_loc_5 && _loc_4 && !Global.isMinimize)
            {
                RoleResourceUtil.addRoleSkill(_loc_5.chainEffect, _loc_5.daoguangModel, _loc_5.hitModel, _loc_5.selfModel, _loc_5.targetModel, _loc_5.trackModel);
            }
            if (param1.count == -1)
            {
                if (_loc_2.leadCount == 0 && _loc_2.useTime > 0)
                {
                    if (_loc_3 is RolePlayer)
                    {
                        AutoFightAI.isLeading = false;
                    }
                }
                if (ActionType.isLeadingAction(_loc_3.actionName))
                {
                    _loc_3.setAction(ActionType.Stand, ActionName.Stand, true);
                }
                _loc_3.isInLeading = false;
                return;
            }
            if (_loc_2.leadCount == 0)
            {
                if (_loc_3 is RolePlayer)
                {
                    AutoFightAI.isLeading = false;
                }
                if (_loc_5)
                {
                    if (_loc_2.useTime > 0)
                    {
                        Dispatcher.dispatchEvent(new DataEvent(EventName.ScenePlaySkill, _loc_2.skillId));
                    }
                    _loc_3.setAction(ActionType.attack, _loc_5.endAction);
                }
                _loc_3.isInLeading = false;
            }
            else if (param1.count == -2)
            {
                if (_loc_3 is RolePlayer)
                {
                    AutoFightAI.isLeading = false;
                }
                if (_loc_3 is MovePlayer && (_loc_3 as MovePlayer).isMove)
                {
                    _loc_3.setAction(ActionType.Walking, ActionName.Walking, true);
                }
                else
                {
                    _loc_3.setAction(ActionType.Stand, ActionName.Stand, true);
                }
                _loc_3.isInLeading = false;
            }
            var _loc_6:* = new Vector.<SpritePlayer>;
            var _loc_8:int = 0;
            while (_loc_8 < param1.toEntityIds.length)
            {
                
                _loc_7 = this.getEntity(param1.toEntityIds[_loc_8], param1.msgEx) as SpritePlayer;
                if (_loc_7)
                {
                    _loc_6.push(_loc_7);
                    _loc_4 = _loc_4 || EntityRelationUtil.isOwnerSelf(_loc_7.entityInfo.entityInfo);
                }
                _loc_8++;
            }
            _loc_9 = ObjectPool.getObject(FightEffectLeadRelease);
            _loc_9.setFromPlayer(_loc_3);
            _loc_9.isNotAutoShield = _loc_4 || EntityRelationUtil.isMonsterPlayer(_loc_3) && !EntityRelationUtil.isSummonMasterPlayer(_loc_3);
            _loc_9.setSkill(_loc_2);
            if (param1.point && (_loc_2.targetSelect == ESkillTargetSelect._ESkillTargetSelectMouseDirection || _loc_2.targetSelect == ESkillTargetSelect._ESkillTargetSelectMouse))
            {
                _loc_10 = new Point();
                _loc_10.x = param1.point.x;
                _loc_10.y = param1.point.y;
                _loc_9.setTargetPoint(_loc_10);
            }
            if (_loc_6.length && (_loc_2.targetSelect == ESkillTargetSelect._ESkillTargetSelectAutoTarget || _loc_2.targetSelect == ESkillTargetSelect._ESkillTargetSelectNeedTarget))
            {
                _loc_9.setTargetPlayer(_loc_6[0]);
            }
            else if (_loc_2.targetSelect == ESkillTargetSelect._ESkillTargetSelectSelf)
            {
                _loc_9.setTargetPlayer(_loc_3);
            }
            _loc_9.setHitPlayers(_loc_6);
            _loc_9.runStart();
            return;
        }// end function

        private function doFightBeginAttackId(param1:int) : void
        {
            var _loc_3:SDoFight = null;
            var _loc_2:* = FightData.getDoFight(param1);
            if (_loc_2 && _loc_2.length)
            {
                for each (_loc_3 in _loc_2)
                {
                    
                    if (_loc_3)
                    {
                        this.doFightStart(_loc_3);
                    }
                }
            }
            FightData.removeBeginFight(param1);
            return;
        }// end function

        public function doFights(param1:SDoFights) : void
        {
            var _loc_4:TSkillModel = null;
            var _loc_5:SpritePlayer = null;
            var _loc_6:SpritePlayer = null;
            var _loc_8:SDoFight = null;
            if (param1 == null || param1.doFights.length == 0)
            {
                return;
            }
            var _loc_2:* = (param1.doFights[0] as SDoFight).skillId;
            var _loc_3:* = SkillConfig.instance.getInfoById(_loc_2);
            if (_loc_3)
            {
                _loc_4 = SkillModelConfig.instance.getInfoById(_loc_3.skillModel);
            }
            var _loc_7:int = 0;
            while (_loc_7 < param1.doFights.length)
            {
                
                _loc_8 = param1.doFights[_loc_7];
                this._gThis.doFight(_loc_8);
                if (_loc_4 && _loc_4.chainEffect)
                {
                    if (_loc_7 == 0)
                    {
                        _loc_5 = ThingUtil.entityUtil.getEntity(_loc_8.fromEntity) as SpritePlayer;
                        _loc_6 = ThingUtil.entityUtil.getEntity(_loc_8.entity) as SpritePlayer;
                    }
                    else
                    {
                        _loc_5 = ThingUtil.entityUtil.getEntity((param1.doFights[(_loc_7 - 1)] as SDoFight).entity) as SpritePlayer;
                        _loc_6 = ThingUtil.entityUtil.getEntity(_loc_8.entity) as SpritePlayer;
                    }
                    if (!Global.isMinimize)
                    {
                        if (_loc_5 && _loc_6)
                        {
                            FightChainUtil.addChain(_loc_5, _loc_6, _loc_4.chainEffect, 1000);
                        }
                    }
                }
                _loc_7++;
            }
            return;
        }// end function

        public function doFight(param1:SDoFight) : void
        {
            if (param1 == null)
            {
                return;
            }
            var _loc_2:* = this.getEntityInfo(param1.entity, param1.msgEx) as EntityInfo;
            if (_loc_2)
            {
                _loc_2.updateAttribute(param1.propertyUpdates, false);
            }
            if (!FightEffectComboUtil.instance.addDofight(param1))
            {
                this.doFightJudgeBeginFight(param1);
            }
            return;
        }// end function

        public function doFightJudgeBeginFight(param1:SDoFight) : void
        {
            if (!FightData.addDoFight(param1))
            {
                this.doFightStart(param1);
            }
            return;
        }// end function

        private function clearComboKey(param1:String) : void
        {
            if (this.comboDic[param1])
            {
                delete this.comboDic[param1];
            }
            return;
        }// end function

        private function doFightStart(param1:SDoFight) : void
        {
            var toPlayer:SpritePlayer;
            var toXRushForward:int;
            var toYRushForward:int;
            var toXHitPoint:int;
            var toYHitPoint:int;
            var skillModel:TSkillModel;
            var attUpdate:SAttributeUpdate;
            var isComboNotShowEffect:Boolean;
            var attackKey:String;
            var isNotAutoShildEffect:Boolean;
            var isNotShildEffect:Boolean;
            var hitDirection:Number;
            var debugStrAlz:String;
            var aryTypes:Array;
            var k:int;
            var ary2:Array;
            var entityInfo:SEntityInfo;
            var tboss:TBoss;
            var radians:Number;
            var beathDis:Number;
            var beatT:Number;
            var targetX:int;
            var targetY:int;
            var toP:Point;
            var tempP:Point;
            var doFight:* = param1;
            if (doFight == null)
            {
                return;
            }
            toPlayer = this.getEntity(doFight.entity, doFight.msgEx) as SpritePlayer;
            var fromPlayer:* = this.getEntity(doFight.fromEntity, doFight.msgEx) as SpritePlayer;
            var skill:* = SkillConfig.instance.getInfoById(doFight.skillId);
            var propertyUpdates:* = doFight.propertyUpdates;
            var isUpdate:Boolean;
            var fightUpdateAttribute:* = new FightUpdateAttribtue();
            var debugStr:String;
            var debugValue:String;
            if (skill)
            {
                fightUpdateAttribute.textDirection = skill.textDirection;
                skillModel = SkillModelConfig.instance.getInfoById(skill.skillModel);
                if (skillModel)
                {
                    isComboNotShowEffect;
                    if (skill.type == ESkillType._ESkillTypeCombo)
                    {
                        attackKey = EntityUtil.toString(doFight.entity) + doFight.attackId;
                        if (this.comboDic[attackKey])
                        {
                            isComboNotShowEffect;
                        }
                        else
                        {
                            this.comboDic[attackKey] = 1;
                            setTimeout(this.clearComboKey, 1000, attackKey);
                        }
                    }
                    if (!isComboNotShowEffect)
                    {
                        isNotAutoShildEffect;
                        if (fromPlayer && fromPlayer.entityInfo)
                        {
                            isNotAutoShildEffect = EntityRelationUtil.isOwnerSelf(fromPlayer.entityInfo.entityInfo) || EntityRelationUtil.isMonsterPlayer(fromPlayer) && !EntityRelationUtil.isSummonMasterPlayer(fromPlayer);
                        }
                        if (toPlayer && toPlayer.entityInfo)
                        {
                            isNotAutoShildEffect = isNotAutoShildEffect || EntityRelationUtil.isOwnerSelf(toPlayer.entityInfo.entityInfo);
                        }
                        isNotShildEffect = FightEffectChecker.check(isNotAutoShildEffect);
                        if (skillModel.hitModel && isNotShildEffect)
                        {
                            hitDirection;
                            if (fromPlayer && toPlayer && skillModel.isHitDirection)
                            {
                                hitDirection = MathUitl.getAngleByXY(fromPlayer.x2d, fromPlayer.y2d, toPlayer.x2d, toPlayer.y2d);
                                hitDirection = hitDirection + 0.01;
                            }
                            SkillEffectUtil.addPlayerEffect(toPlayer, skillModel.hitModel, true, fromPlayer is RolePlayer, null, PlayMode.ANIMATION_STOP_MODE, false, true, hitDirection);
                        }
                    }
                }
            }
            fightUpdateAttribute.isPet = fromPlayer is PetPlayer;
            fightUpdateAttribute.random(doFight.attackId);
            var _loc_3:int = 0;
            var _loc_4:* = propertyUpdates;
            while (_loc_4 in _loc_3)
            {
                
                attUpdate = _loc_4[_loc_3];
                switch(attUpdate.value)
                {
                    case EHurtType._EHurtTypeBlock:
                    {
                        break;
                    }
                    case EHurtType._EHurtTypeCrit:
                    {
                        break;
                    }
                    case EHurtType._EHurtTypeJouk:
                    {
                        break;
                    }
                    case EHurtType._EHurtTypeCrush:
                    {
                        break;
                    }
                    case EHurtType._EHurtTypeImmune:
                    {
                        break;
                    }
                    case EHurtType._EHurtTypeAnti:
                    {
                        break;
                    }
                    case EHurtType._EHurtTypeNormal:
                    {
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeHurt)
                {
                    continue;
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeManaHurt)
                {
                    continue;
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeHurtSuck)
                {
                    continue;
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeHurtToCure)
                {
                    continue;
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeHurtReflex)
                {
                    continue;
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeHurtRebound)
                {
                    continue;
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeHurtPlusMinus)
                {
                    continue;
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeRushForwardPointX)
                {
                    continue;
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeRushForwardPointY)
                {
                    continue;
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeBeatMoveToPointX)
                {
                    continue;
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeBeatMoveToPointY)
                {
                    continue;
                }
                if (attUpdate.attribute.value() == EEntityAttribute._EAttributeHurtDebugInfo)
                {
                    continue;
                }
            }
            if (debugStr)
            {
                debugStrAlz;
                aryTypes = debugStr.split("#");
                k;
                while (k < aryTypes.length)
                {
                    
                    ary2 = String(aryTypes[k]).split(",");
                    debugStrAlz = debugStrAlz + GameDefConfig.instance.getHurtTypeName(int(ary2[0]));
                    debugStrAlz = debugStrAlz + (":" + ary2[1] + " ");
                    k = (k + 1);
                }
                debugStrAlz = debugStrAlz + ("  随机数:" + debugValue);
            }
            if (toPlayer != null && toPlayer.entityInfo)
            {
                entityInfo = toPlayer.entityInfo.entityInfo;
                if (!fromPlayer || toPlayer is RolePlayer || EntityRelationUtil.isOwnerSelf(entityInfo))
                {
                    fightUpdateAttribute.textDirection = 1;
                }
                if (!fightUpdateAttribute.textDirection)
                {
                    fightUpdateAttribute.fromX = fromPlayer.x2d;
                    fightUpdateAttribute.fromY = fromPlayer.y2d;
                    fightUpdateAttribute.toX = toPlayer.x2d;
                    fightUpdateAttribute.toY = toPlayer.y2d;
                    fightUpdateAttribute.toX3D = toPlayer.x;
                    fightUpdateAttribute.toY3D = toPlayer.y;
                    fightUpdateAttribute.toZ3D = toPlayer.z;
                }
                if (fightUpdateAttribute.hurtNumber != 0)
                {
                    toPlayer.entityInfo.updateLifeShow();
                    toPlayer.hurt(fightUpdateAttribute.hurtNumber);
                }
                if ((fightUpdateAttribute.hurtNumber > 0 || fightUpdateAttribute.manaNumber > 0) && !fightUpdateAttribute.isAdd)
                {
                    toPlayer.setAction(ActionType.Injury, ActionName.Injury);
                }
                if (fromPlayer && EntityRelationUtil.isOwnerSelf(fromPlayer.entityInfo.entityInfo) || toPlayer && EntityRelationUtil.isOwnerSelf(toPlayer.entityInfo.entityInfo) || fightUpdateAttribute.hurtNumber < 0)
                {
                    toPlayer.cutHurtImpl(fightUpdateAttribute);
                }
                if (fromPlayer && fromPlayer is RolePlayer)
                {
                    if (toPlayer.entityInfo.entityInfo.life <= 0 && toPlayer is MonsterPlayer && skill && skill.isDeathBeatBack)
                    {
                        tboss = (toPlayer as MonsterPlayer).bossInfo;
                        if (tboss && tboss.speed > 0 && tboss.corpseTime == 0)
                        {
                            (toPlayer as MovePlayer).stopMove();
                            radians = MathUitl.getRadiansByXY(RolePlayer.instance.x2d, RolePlayer.instance.y2d, toPlayer.x2d, toPlayer.y2d);
                            beathDis = 200 + Math.random() * 100;
                            beatT = beathDis / 600;
                            targetX = toPlayer.x2d + Math.cos(radians) * beathDis;
                            targetY = toPlayer.y2d + Math.sin(radians) * beathDis;
                            toP = GameMapUtil.getTilePoint(targetX, targetY);
                            tempP = AstarAnyDirection.getMaxVisiblePoint(int(toPlayer.x2d / GameMapUtil.tileWidth), int(toPlayer.y2d / GameMapUtil.tileHeight), toP.x, toP.y);
                            toP = GameMapUtil.getPixelPoint(tempP.x, tempP.y);
                            toPlayer.tweenLite = TweenLite.to(toPlayer, beatT, {x2d:toP.x, y2d:toP.y, onComplete:function () : void
            {
                toPlayer.removeTweenLite();
                return;
            }// end function
            });
                        }
                        if (toPlayer.bodyPlayer.hasAction(ActionName.DeathSpecial))
                        {
                            toPlayer.setAction(ActionType.Death, ActionName.DeathSpecial);
                        }
                    }
                }
            }
            if (toXRushForward && toYRushForward && fromPlayer)
            {
                JumpUtil.jumpCut(fromPlayer as MovePlayer, toXRushForward, toYRushForward, 0.2, 0.2, null);
                if (skill.type == ESkillType._ESkillTypeRushForward && skill.useTime > 0)
                {
                    if (skillModel && skillModel.selfModel && !SkillUtil.isBrillyGouriSkill(skill.skillId))
                    {
                        SkillEffectUtil.addPlayerEffect(fromPlayer, skillModel.selfModel, true, fromPlayer is RolePlayer);
                    }
                }
            }
            if (toXHitPoint && toYHitPoint && toPlayer)
            {
                toPlayer.setRealPoint(toXHitPoint, toYHitPoint);
                toPlayer.tweenLite = TweenMax.to(toPlayer, 0.05, {x2d:toXHitPoint, y2d:toYHitPoint, frameInterval:1, ease:Linear.easeIn, onUpdate:function () : void
            {
                ThingUtil.isEntitySort = true;
                return;
            }// end function
            , onComplete:function () : void
            {
                (toPlayer as MovePlayer).updateCurrentAlpha();
                toPlayer.removeTweenLite();
                return;
            }// end function
            });
            }
            return;
        }// end function

        public static function isShieldSkill() : Boolean
        {
            if (MapFileUtil.mapID == GameConst.FirstMapID && FrameUtil.isDriverSoftRender)
            {
                return true;
            }
            if (Cache.instance.copy.challengCopy.isInChallengeCopy)
            {
                return false;
            }
            if (SystemSetting.instance.isHideAllEffect.bValue || SystemSetting.instance.isHideSkill.bValue || !Global3D.loadResource)
            {
                return true;
            }
            return false;
        }// end function

        public static function isShieldEffect() : Boolean
        {
            if (MapFileUtil.mapID == GameConst.FirstMapID && FrameUtil.isDriverSoftRender)
            {
                return true;
            }
            if (SystemSetting.instance.isHideAllEffect.bValue || !Global3D.loadResource)
            {
                return true;
            }
            return false;
        }// end function

        private static function clearAttackMeMonster() : void
        {
            attackMeMonster = null;
            return;
        }// end function

        private static function addToAttackList(param1:SEntityId, param2:int = 1000) : void
        {
            removeFromList(param1);
            attackMeMonsterList.push(param1);
            var _loc_3:* = setTimeout(removeFromList, param2, param1);
            dicMonsterTimer[param1] = _loc_3;
            return;
        }// end function

        private static function removeFromList(param1:SEntityId) : void
        {
            var _loc_3:uint = 0;
            var _loc_2:* = attackMeMonsterList.indexOf(param1);
            if (_loc_2 != -1)
            {
                attackMeMonsterList.splice(_loc_2, 1);
                _loc_3 = dicMonsterTimer[param1];
                clearTimeout(_loc_3);
            }
            return;
        }// end function

    }
}
